package com.enation.app.javashop.api.client;

import com.enation.app.javashop.model.member.vo.RegionVO;
import com.enation.app.javashop.model.system.dos.Regions;
import com.enation.app.javashop.service.system.RegionsManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * @author fk
 * @version v2.0
 * @Description:
 * @date 2018/8/17 16:29
 * @since v7.0.0
 */
@RestController
@RequestMapping("/client/regions")
@ApiIgnore
public class RegionsClientController {

    @Autowired
    private RegionsManager regionsManager;

    @GetMapping("/children")
    public List<Regions> getRegionsChildren(@RequestParam("region_id") Long regionId) {
        return regionsManager.getRegionsChildren(regionId);
    }


    @GetMapping("/{id}")
    public Regions getModel(@PathVariable Long id) {
        return regionsManager.getModel(id);
    }

    @GetMapping("/depth/{depth}")
    public List<RegionVO> getRegionByDepth(@PathVariable("depth")Integer depth) {
        return regionsManager.getRegionByDepth(depth);
    }

}
